import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import Login from '@/components/Login'
// import Login2 from '@/components/Login2'
import Home from '@/components/Home'
import Home2 from '@/components/Home2'
// import User from '@/components/User'
// import UserAdd from '@/components/UserAdd'
// import UserEdit from '@/components/UserEdit'
import Student from '@/components/Student'
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Home',
      redirect: '/home',
      component: Home
    },
    // {
    //   path: '/',
    //   name: 'Login2',
    //   component: Login2
    // },
    {
      path: '/hello',
      name: 'HelloWorld',
      component: HelloWorld
    },
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/Home2',
      name: 'Home2',
      component: Home2
    },
    // {path: '/home', component: Home},
    {
      // home1页面并不需要被访问，只是作为其它组件的父组件
      path: '/home',
      name: 'Home',
      component: Home,
      meta: {
        requireAuth: true
      },
      redirect: '/index',
      children: [
        {
          path: '/index',
          name: 'User',
          component: () => import('@/views/user/pgUser'),
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/test',
          name: 'Test',
          component: () => import('@/views/user/test'),
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/form',
          name: 'Index',
          component: () => import('@/views/form/form'),
          meta: {
            requireAuth: true
          }
        },
        {
          path: '/table',
          name: 'Table',
          component: () => import('@/views/table/table'),
          meta: {
            requireAuth: true
          }
        }
      ]
    },
    // {
    //   path: '/user',
    //   component: User,
    //   children: [
    //     {path: 'add', component: UserAdd}, // 用户添加路由
    //     {path: 'edit', component: UserEdit} // 用户添加路由
    //   ]
    // },
    {path: '/student', component: Student}
  ]
})
